home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 28
/
Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso
/
Aminet
/
dev
/
lang
/
fpcsrc.lha
/
fpc
/
compiler
/
makefile
< prev
next >
Wrap
Makefile
|
1998-09-24
|
13KB
|
550 lines
#
# $Id: makefile,v 1.6.2.3 1998/08/06 14:27:26 pierre Exp $
# This file is part of the Free Pascal run time library.
# Copyright (c) 1993-98 by the Free Pascal Development Team
#
# Makefile for the Free Pascal Compiler
#
# See the file COPYING.FPC, included in this distribution,
# for details about the copyright.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
#####################################################################
# Try to determine Operating System
#####################################################################
BASEDIR=$(shell pwd)
# in linux no : in pathes
ifeq ($(findstring :,$(BASEDIR)),)
inlinux=1
endif
# in case pwd is not present on the DOS-OS
ifeq ($(strip $(BASEDIR)),'')
inlinux=
BASEDIR:=.
endif
# What compiler to use
ifndef PP
PP=ppc386
endif
#####################################################################
# Setup Targets
#####################################################################
# what target do we use
# currently dos go32v2 os2 and linux are available
ifdef inlinux
TARGET=linux
else
TARGET=go32v2
endif
# What processor do you want to compile for : i386 m68k (case sensitive !!)
ifndef CPU
CPU= i386
# CPU= m68k
endif
BUGFIX=YES
export BUGFIX
#####################################################################
# Setup Files Directories
#####################################################################
# Set os-dependent files and extensions
ifdef inlinux
EXEEXT=
REPLACE=mv -f
CP=cp -f
else
EXEEXT=.exe
REPLACE=move /y
CP=cp -f
endif
COMPILERDIR=$(BASEDIR)
RTLDIR:=c:/pas/fpk/curver/rtl
# specify where units are.
# This needs to be set correctly for the 'remake' target to work !
ifndef UNITDIR
UNITDIR=$(RTLDIR)/$(TARGET)
ifeq ($(TARGET),dos)
UNITDIR=$(RTLDIR)/dos/go32v1
endif
ifeq ($(TARGET),go32v2)
UNITDIR=$(RTLDIR)/dos/go32v2
endif
endif
# not def UNITDIR
# Where to install the executable program/link
ifndef PROGINSTALLDIR
ifdef inlinux
PROGINSTALLDIR = /usr/bin
else
PROGINSTALLDIR = c:\pp\bin
endif
endif
# !!! Linux only
# Where to install the _real_executable and support files
ifndef LIBINSTALLDIR
ifdef inlinux
LIBINSTALLDIR=/usr/lib/fpc/0.99.5
# for a.out
# LIBINSTALLDIR=/usr/lib/ppc/aout/0.99.5
else
LIBINSTALLDIR=$(PROGINSTALLDIR)
endif
endif
# Where the .msg files will be stored
ifndef MSGINSTALLDIR
MSGINSTALLDIR=$(LIBINSTALLDIR)/msg
endif
ifndef UNITINSTALLDIR
ifdef inlinux
UNITINSTALLDIR=$(LIBINSTALLDIR)/linuxunits
else
UNITINSTALLDIR=$(UNITDIR)
endif
endif
# !!! Linux only
# GCCLIBPATH is wat is it on my PC... it MUST be set in the main Makefile
ifndef GCCLIBPATH
GCCLIBPATH=/usr/lib/gcc-lib/i486-linux/2.6.3
endif
#####################################################################
# When making diffs of the sources
#####################################################################
# Diff program
DIFF = diff
# Diff3 program
DIFF3 = diff3
# Options to diff.
DIFFOPTS = -b -c
# Directory where files are to make diffs with..
ifdef inlinux
DIFDIR = /usr/local/fpk/work/new/compiler
else
DIFDIR = h:/cvs/compiler
endif
# Directory where reference files are for diff3
ifdef inlinux
REFDIR = /usr/local/fpk/dist/source/compiler
else
REFDIR = h:/myref/compiler
endif
#####################################################################
# End of configurable section. Do not edit after this line.
#####################################################################
DIFFEXIST:=$(shell $(DIFF) --help)
# Used to avoid unnecessary steps in remake3
ifdef DIFFEXIST
ifdef OLDPP
DIFFRESULT:=$(shell $(DIFF) $(OLDPP) $(PP))
else
DIFFRESULT=Not equal
endif
else
DIFFRESULT=No diff program
endif
# set correct defines (also needed by mkdep)
PPDEFS:=-d$(CPU) -dGDB -dFPC
# Set the needed compiler options
PPOPTS:=$(OPT) $(PPDEFS) -Sg
# Unitdir specified ?
ifneq ("$(UNITDIR)", "")
PPOPTS:=$(PPOPTS) -Up$(UNITDIR)
endif
# Do we need the GCC library ?
ifeq ($(LINK_TO_C),YES)
PPOPTS:=$(PPOPTS) -Fg$(GCCLIBPATH)
endif
# Create the whole compiler commandline
COMPILER=$(PP) $(PPOPTS)
#####################################################################
# Setup os-independent filenames
#####################################################################
PPEXENAME=pp$(EXEEXT)
EXENAME=ppc386$(EXEEXT)
TEMPNAME=ppc$(EXEEXT)
TEMPNAME1=ppc1$(EXEEXT)
TEMPNAME2=ppc2$(EXEEXT)
TEMPNAME3=ppc3$(EXEEXT)
MAKEDEP=mkdep$(EXEEXT)
PASFILES:=$(shell ls *.pas)
INCFILES:=$(shell ls *.inc)
MSGFILES:=$(shell ls *.msg)
#####################################################################
# Default makefile
#####################################################################
.SUFFIXES: .pas $(EXEEXT) .ppu .dif .d3p .d3i .d3m .new
.PHONY : all clean info \
cycle remake remake3 \
install \
diff diff3 patch rtl toflor replacediff3 restorediff3 \
test rtlzip \
.pas.ppu:
$(COMPILER) $<
.pas$(EXEEXT):
$(COMPILER) $<
all : $(EXENAME)
ifndef DIFFRESULT
next :
echo $(PP) and $(OLDPP) are equal
$(CP) $(PP) $(EXENAME)
else
next :
$(MAKE) clean
$(MAKE) -C $(UNITDIR) clean
$(MAKE) -C $(UNITDIR) 'PP=$(COMPILERDIR)/$(PP)' all
$(MAKE) all
endif
clean :
-rm -f *.o *.ppu *.s $(EXENAME)
#####################################################################
# Info
#####################################################################
info :
@echo - Target is $(TARGET)
@echo - Basedir is $(BASEDIR)
@echo - Pascal files are $(PASFILES)
@echo - Inc files are $(INCFILES)
@echo - Msg files are $(MSGFILES)
#####################################################################
# Include depencies (linux only)
#####################################################################
ifdef inlinux
$(MAKEDEP) : $(RTLDIR)/utils/mkdep.pp
$(PP) $(RTLDIR)/utils/mkdep.pp
$(CP) $(RTLDIR)/utils/$(MAKEDEP) $(MAKEDEP)
dependencies : $(MAKEDEP)
$(MAKEDEP) pp.pas $(PPDEFS) '-A$$(COMPILER)' > depend
include depend
endif
#####################################################################
# Make targets
#####################################################################
msgtxt.inc: errore.msg
msg2inc errore.msg msgtxt.inc msgtxt
optmsg.inc: optione.msg
msg2inc optione.msg optmsg.inc optiontxt
msg: msgtxt.inc optmsg.inc
# Make only the compiler
ifdef inlinux
$(EXENAME) : $(PPEXENAME)
$(COMPILER) pp.pas
$(REPLACE) $(PPEXENAME) $(EXENAME)
else
$(EXENAME) : $(PASFILES) $(INCFILES) $(MSGFILES)
$(COMPILER) pp.pas
$(REPLACE) $(PPEXENAME) $(EXENAME)
endif
# This target remakes the units with the currently made version
remake: $(EXENAME)
$(REPLACE) $(EXENAME) $(TEMPNAME)
$(MAKE) clean
$(MAKE) -C $(UNITDIR) clean
$(MAKE) -C $(UNITDIR) 'PP=$(COMPILERDIR)/$(TEMPNAME)' all
$(MAKE) 'PP=./$(TEMPNAME)' all
remake3: $(TEMPNAME3)
$(MAKE) 'PP=./$(TEMPNAME3)' 'OLDPP=./$(TEMPNAME2)' next
diff $(TEMPNAME3) $(EXENAME)
$(TEMPNAME1) : $(EXENAME)
$(REPLACE) $(EXENAME) $(TEMPNAME1)
$(TEMPNAME2) : $(TEMPNAME1)
$(MAKE) 'PP=./$(TEMPNAME1)' 'OLDPP=' next
$(REPLACE) $(EXENAME) $(TEMPNAME2)
$(TEMPNAME3) : $(TEMPNAME2)
$(MAKE) 'PP=./$(TEMPNAME2)' 'OLDPP=./$(TEMPNAME1)' next
$(REPLACE) $(EXENAME) $(TEMPNAME3)
cycle:
$(MAKE) clean
$(MAKE) -C $(UNITDIR) clean
$(MAKE) -C $(UNITDIR)
$(MAKE) remake3
#####################################################################
# Installation
#####################################################################
install:
umask 022
strip ppc386
install -m 755 -d $(LIBINSTALLDIR)
install -m 755 ppc386 $(LIBINSTALLDIR)
ln -sf $(LIBINSTALLDIR)/ppc386 $(PROGINSTALLDIR)/ppc386
makecfg $(LIBINSTALLDIR)/samplecfg $(UNITINSTALLDIR) $(MSGINSTALLDIR) $(GCCLIBPATH)
install -m 755 -d $(MSGINSTALLDIR)
install -m 666 errore.msg $(MSGINSTALLDIR)
install -m 666 errorn.msg $(MSGINSTALLDIR)
#####################################################################
# Diffs
#####################################################################
SOURCEFILES = $(PASFILES) $(INCFILES) $(MSGFILES) Makefile
DIFFFILES = $(patsubst %.pas,%.dif,$(PASFILES)) \
$(patsubst %.inc,%.dif,$(INCFILES)) \
$(patsubst %.msg,%.dif,$(MSGFILES)) \
Makefil